enqueue i in q while q is not empty do get friends_uids according to i for each j in friends_uids do
if j does not exist in q then
insert j into q
end end dequeue k from q get profile according to k set i = k end